package com.dgut.epidemic.controller;

import com.dgut.epidemic.pojo.Daily_data;
import com.dgut.epidemic.pojo.WeChatUser;
import com.dgut.epidemic.service.WeChatUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


/**
 * Author: wuhaoduan
 * Date: 2021/6/6 9:04
 */
@RestController
@RequestMapping("/wechat")
public class WeChatController {

    @Autowired
    private WeChatUserService weChatUserService;

    @GetMapping("/judgeWeChatUser")
    public int judgeWeChatUser(String id,String password) {
        int result = weChatUserService.judgeWeChatUser(id, password);
        return result;
    }

    @GetMapping("/getWeChatUserById")
    public WeChatUser getWeChatUserById(String id){
        return weChatUserService.getWeChatUserById(id);
    }

    @GetMapping("/judgeUserIsSubmit")
    public int judgeUserIsSubmit(String id){
        return  weChatUserService.judgeUserIsSubmit(id);
    }

    @RequestMapping("/insertDailyData")
    public void insertDailyData(Daily_data daily_data){
        System.out.println(daily_data);
        weChatUserService.insertDailyData(daily_data);
    }
}
